package com.happyclub.paul.service.impl;

import com.happyclub.paul.service.IFastdfsService;
import com.happyclub.utils.FastDFSClientUtils;
import org.springframework.stereotype.Service;

import java.io.File;

/**
 * @Auther: 魏泉琦
 * @Date: 2019/4/8 12:41
 * @Description: fastdfs
 */
@Service
public class FastdfsServiceImpl implements IFastdfsService{

    /**
     *@Description: 上传至fastdfs 返回标识
     *@Author: 魏泉琦
     *@date: 2019/4/8
     */
    @Override
    public String uploadFile(String filePath) throws Exception {
        System.out.println(filePath);
        File file = new File(filePath);
        String fileId = FastDFSClientUtils.upload(file, filePath);
        System.out.println("本地文件：" + filePath + "，上传成功！ 文件ID为：" + fileId);
        return fileId;
    }
}
